package org.nepu.srr.安全管理文件.安全管理文件;

import cn.hutool.core.lang.Validator;
import cn.hutool.json.JSONUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nepu.sc.domain.DataVO;
import org.nepu.sc.domain.CommonMethods;
import org.nepu.sc.reflect.CommonRateUtil;

@Slf4j
@Data
@ApiModel(value = "安全管理文件")
public class B31SafeManagementFileParams {
    @ApiModelProperty(value = "联合作业安全管理文件(合格/不合格)")
    DataVO jointHomeworkFile;

    @ApiModelProperty(value = "井控应急预案程序文件(合格/不合格)")
    DataVO wellControlPlanFile;

    @ApiModelProperty(value = "火灾/爆炸程序文件(合格/不合格)")
    DataVO fireProgramFile;

    @ApiModelProperty(value = "中毒应急程序文件(合格/不合格)")
    DataVO poisoningEmergencyFile;

    @ApiModelProperty(value = "防硫化氢程序文件(合格/不合格)")
    DataVO antiHydrogenSulfideFile;

    @ApiModelProperty(value = "人员落水应急程序文件(合格/不合格)")
    DataVO personnelDrowningFile;

    @ApiModelProperty(value = "事故报告及处理程序文件(合格/不合格)")
    DataVO accidentReportFile;

    @ApiModelProperty(value = "演习制度程序文件(合格/不合格)")
    DataVO exerciseSystemFile;

    @ApiModelProperty(value = "弃平台专项应急预案(合格/不合格)")
    DataVO disposalPlatformEmergencyPlan;


    public B31SafeManagementFileParams jsonBuild(String jsonStr){
        if (Validator.isEmpty(jsonStr)){
            return new B31SafeManagementFileParams();
        }else {
            return JSONUtil.toBean(jsonStr, B31SafeManagementFileParams.class);
        }
    }

    public double rate(){
        // 满分是 90
        return CommonRateUtil.rate(this);
    }
}
